package cn.lesion.JavaBean;

import javax.persistence.*;
import java.sql.Date;

/**
 * Created in Intellij IDEA .
 * Author : e.le.lee .
 * Date : 2015-12-31-0031 .
 */
@Entity
@Table(name = "article", schema = "mycms", catalog = "")
public class ArticleEntity {
    private int newsId;
    private String newsTitle;
    private String newsBody;
    private String newsAuthor;
    private Date newsDate;
    private int isContent;

    @Id
    @Column(name = "news_id", nullable = false)
    public int getNewsId() {
        return newsId;
    }

    public void setNewsId(int newsId) {
        this.newsId = newsId;
    }

    @Basic
    @Column(name = "news_title", nullable = false, length = 255)
    public String getNewsTitle() {
        return newsTitle;
    }

    public void setNewsTitle(String newsTitle) {
        this.newsTitle = newsTitle;
    }

    @Basic
    @Column(name = "news_body", nullable = true, length = -1)
    public String getNewsBody() {
        return newsBody;
    }

    public void setNewsBody(String newsBody) {
        this.newsBody = newsBody;
    }

    @Basic
    @Column(name = "news_author", nullable = false, length = 255)
    public String getNewsAuthor() {
        return newsAuthor;
    }

    public void setNewsAuthor(String newsAuthor) {
        this.newsAuthor = newsAuthor;
    }

    @Basic
    @Column(name = "news_date", nullable = true)
    public Date getNewsDate() {
        return newsDate;
    }

    public void setNewsDate(Date newsDate) {
        this.newsDate = newsDate;
    }

    @Basic
    @Column(name = "is_content", nullable = false)
    public int getIsContent() {
        return isContent;
    }

    public void setIsContent(int isContent) {
        this.isContent = isContent;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        ArticleEntity that = (ArticleEntity) o;

        if (newsId != that.newsId) return false;
        if (isContent != that.isContent) return false;
        if (newsTitle != null ? !newsTitle.equals(that.newsTitle) : that.newsTitle != null) return false;
        if (newsBody != null ? !newsBody.equals(that.newsBody) : that.newsBody != null) return false;
        if (newsAuthor != null ? !newsAuthor.equals(that.newsAuthor) : that.newsAuthor != null) return false;
        if (newsDate != null ? !newsDate.equals(that.newsDate) : that.newsDate != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = newsId;
        result = 31 * result + (newsTitle != null ? newsTitle.hashCode() : 0);
        result = 31 * result + (newsBody != null ? newsBody.hashCode() : 0);
        result = 31 * result + (newsAuthor != null ? newsAuthor.hashCode() : 0);
        result = 31 * result + (newsDate != null ? newsDate.hashCode() : 0);
        result = 31 * result + isContent;
        return result;
    }
}
